Skip to content

Normalize chains/ directory for Substrate and tar snapshots#21

Merged
vukomir merged 1 commit intomainfrom
feat/substrate-chains-dir-snapshot-tar
Mar 31, 2026
Merged

Normalize chains/ directory for Substrate and tar snapshots#21
vukomir merged 1 commit intomainfrom
feat/substrate-chains-dir-snapshot-tar

Conversation

@vukomir
Copy link
Copy Markdown
Contributor

@vukomir vukomir commented Mar 30, 2026

  • Add SubstrateChainsDirName (hyphens to underscores) for ChainDBDataPath and RelayChainDBDataPath so on-disk layout matches the node.
  • Extend tar extraction to strip chains//db|paritydb/ prefixes using both YAML chain_id and normalized segment; pass chain_id from SyncIfNeeded.
  • Add tests for path mapping and snapshot sync with underscore archive paths.

- Add SubstrateChainsDirName (hyphens to underscores) for ChainDBDataPath and RelayChainDBDataPath so on-disk layout matches the node.
- Extend tar extraction to strip chains/<id>/db|paritydb/ prefixes using both YAML chain_id and normalized segment; pass chain_id from SyncIfNeeded.
- Add tests for path mapping and snapshot sync with underscore archive paths.

Made-with: Cursor
Copilot AI review requested due to automatic review settings March 30, 2026 16:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Normalizes on-disk chains/ directory naming to match Substrate’s hyphen→underscore behavior, and improves tar snapshot extraction to handle archives that include chains/<id>/<db|paritydb>/... prefixes.

Changes:

  • Add config.SubstrateChainsDirName() and use it in ChainDBDataPath / RelayChainDBDataPath.
  • Extend tar extraction to rewrite member paths by stripping chains/<id>/<storageDir>/ (matching both YAML chain_id and normalized directory segment).
  • Update snapshot sync call sites/signature and add tests for underscore paths in tar archives.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/snapshot/snapshot.go Adds chain-id-aware tar member path mapping and updates tar extraction to strip chains/<id>/<storageDir> prefixes safely.
internal/snapshot/snapshot_test.go Adds tests for the new tar path mapping and updates existing SyncIfNeeded call sites for the new signature.
internal/config/config.go Introduces SubstrateChainsDirName() and applies it to chain DB path construction.
internal/config/config_test.go Extends fixed-path tests to cover hyphenated chain IDs mapping to underscore directories.
cmd/bootstrap/main.go Passes YAML chain_id through to snapshot sync for tar path rewriting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/config/config.go
Comment thread internal/snapshot/snapshot_test.go
Comment thread internal/snapshot/snapshot_test.go
@vukomir vukomir merged commit d33cd2e into main Mar 31, 2026
9 checks passed
@vukomir vukomir deleted the feat/substrate-chains-dir-snapshot-tar branch March 31, 2026 08:04
@vukomir vukomir restored the feat/substrate-chains-dir-snapshot-tar branch March 31, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants